/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package context;

import commands.ICommand;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

/**
 *
 * eCOM - Adopte un Presta - Mars-Avril 2013
 * @author Kheira, Jef, William, Tuan-Long
 */
public class ContextBase implements IContext {
    private Map<String, Object> varEnviro;
    private Map<String, ICommand> commands;

    public ContextBase()
    {
        varEnviro = new TreeMap<String,Object>();
	commands = Collections.emptyMap();
    }

    @Override
    public Object getVar(String key)
    {
        return varEnviro.get(key);
    }
	
    @Override
    public Set<String> getVarNames()
    {
        return varEnviro.keySet();
    }
	
    @Override
    public void setVar(String key, Object value)
    {
        varEnviro.put(key,value);
    }
	
    @Override
    public Object unsetVar(String key)
    {
        return varEnviro.remove(key);
    }

    @Override
    public Map<String, ICommand> getCommands() 
    {
        return Collections.unmodifiableMap(this.commands);
    }

    @Override
    public void setCommands(Map<String, ICommand> commands) 
    {
        this.commands = commands;
    }

	
}
